
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"http://www.w3.org/TR/html4/strict.dtd">
<html lang="pt_BR">
<head>
	<meta charset="utf-8">
	<link rel="icon" type="image/png" href="images/icone.png">
	<title><?php include('titulo.php')?></title>
	<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
 	
	<link rel="stylesheet" href="css/jquery-ui-1.8.21.custom.css" type="text/css" media="all" />
	<link rel="stylesheet" href="css/index.css"  media="screen"> 
	<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"  media="screen"> 
	
	<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script> 
	<script type="text/javascript" src="js/bootstrap-inputmask.js"/></script>
	
    <script type="text/javascript" src="js/jquery.validate.min.js"></script> 
	<script type="text/javascript" language="javascript" >
		$(document).ready(function(){
			$('#form').validate({  
				rules: {  
					setor: { required: true }
					
				},  
				messages: {  
					setor: { required: 'Preencha o campo'}
				},  
				submitHandler: function( form ){  
					var dados = $( form ).serialize();  
					$.ajax({  
						type: "POST",  
						url: "c_setor.php",  
						data: dados,  
						success: function( data )  
						{  
							alert( data );
							$("input[name='setor']").val('');
							$("input[name='setor']").focus();
						}  
					});  
	  				return false;  
				}  
			}); 
		}); 
	</script>
</head>
<body>
	<div id="container">
		<div id="topo" style="text-align:left;position:absolute;">
			<?php include('cabecalho.php') ?>
		</div>
		<br><br>
		<div id="body">
			<form id="form">
				<fieldset>
				<legend>Lista Ramais por Setor - PDF</legend>
				
				<label>Secretaria</label>
				<select name="idsecretaria">
					<?php
						header ('Content-type: text/html; charset=UTF-8'); 
						$dblink = mysql_connect('localhost', 'root', '') or die( mysql_error() );
						mysql_select_db('listaramais');
						 
						// query the database table for zip codes that match 'term'
						$rs = mysql_query('SELECT idsetor, sigla, nomeSetor FROM setor, secretaria
										WHERE  idsecretaria = secretaria_idsecretaria');

						// loop through each zipcode returned and format the response for jQuery
						$data = array();
						if ( $rs && mysql_num_rows($rs) )
						{
							while( $row = mysql_fetch_array($rs) )
							{
								echo '<option value='.$row["idsetor"].'>'.$row["sigla"].' - '.$row["nomeSetor"].'</option>';
							}
						}
					?>
				</select>
				
				<br>
				<button type="submit" class="btn">Gerar PDF</button>
				</fieldset>
				</form>
		</div>
	</div>
</body>
</html>